﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mr="http://mishrareader.codeplex.com/Reader"
                    xmlns:viewModels="clr-namespace:MishraReader.ViewModels;assembly=MishraReader.ViewModels"
                    xmlns:mishraReader="clr-namespace:MishraReader;assembly=MishraReader.ViewModels">
    <DataTemplate DataType="{x:Type viewModels:SignInViewModel}">
        <Grid Width="300">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <TextBlock Text="{x:Static mishraReader:Strings.SignInSmall}" Style="{DynamicResource MetroHeader1}" />

            <Border Grid.Row="1">
                <Grid>
                    <StackPanel Margin="0,20,0,0" IsEnabled="{Binding IsBusy, Converter={StaticResource InverseBooleanConverter}}"  Width="250" HorizontalAlignment="Left" VerticalAlignment="Top">
                        <mr:WatermarkTextBox 
                            Text="{Binding Username}"
                            Watermark="{x:Static mishraReader:Strings.Username}"
                            
                            />
                        <mr:WatermarkPasswordBox 
                            Password="{Binding Password}"  
                            Margin="0,15,0,0" 
                            Watermark="{x:Static mishraReader:Strings.Password}"
                            />
                        <CheckBox IsChecked="{Binding RememberMe}" Content="{x:Static mishraReader:Strings.RememberMe}" Margin="0,15,0,0"/>

                        <Border Margin="0,15,0,0"   Visibility="{Binding ErrorMessage, Converter={StaticResource NotNullToVisibilityConverter}}" >
                            <TextBlock Foreground="{StaticResource MetroTextBoxErrorBorder}" TextWrapping="Wrap" Text="{Binding ErrorMessage}"/>
                        </Border>

                        <Grid Margin="0,15,0,0" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <mr:BusyIndicator Margin="0,0,20,0" VerticalAlignment="Bottom" IsBusy="{Binding IsBusy}" BusyMessage="{x:Static mishraReader:Strings.Connecting}" />

                            <Button Content="{x:Static mishraReader:Strings.SignIn}" 
                                    HorizontalAlignment="Right" 
                                    IsDefault="True" 
                                    Command="{Binding ConnectCommand}" Grid.Column="1" />
                        </Grid>

                        <Button  Margin="0,15,0,0" Content="{x:Static mishraReader:Strings.Close}" HorizontalAlignment="Right" Command="{Binding CancelCommand}" IsCancel="True" />
                    </StackPanel>

                </Grid>
            </Border>


        </Grid>
    </DataTemplate>
</ResourceDictionary>